package com.example.hrmsaas.system.service.impl;

import com.example.hrmsaas.system.entity.PermissionPoint;
import com.example.hrmsaas.system.mapper.PermissionPointMapper;
import com.example.hrmsaas.system.service.IPermissionPointService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 雷哥
 * @since 2021-11-10
 */
@Service
public class PermissionPointServiceImpl extends ServiceImpl<PermissionPointMapper, PermissionPoint> implements IPermissionPointService {

    private Log log = (Log) LogFactory.getLog(PermissionPointServiceImpl.class);
    @Autowired
    PermissionPointMapper pointMapper;

    @Override
    public boolean add(PermissionPoint point) throws Exception {
        int code=pointMapper.insert(point);
        Exception exception = null;
        if(code>0){
            return true;
        }else{
            return false;
        }
    }

    @Override
    public boolean edit(PermissionPoint point) throws Exception {
        int code=pointMapper.updateById(point);
        Exception exception = null;
        if(code>0){
            return true;
        }else{
            assert false;
            log.info("PermissionPointServiceImpl执行更新异常"+exception.getMessage());
            return false;
        }
    }

    @Override
    public PermissionPoint getInfoByid(String id) throws Exception {
        return pointMapper.selectById(id);
    }

    @Override
    public boolean delet(String id) throws Exception {
        int code=pointMapper.deleteById(id);
        Exception exception = null;
        if(code>0){
            return true;
        }else{
            assert false;
            log.info("PermissionPointServiceImpl执行删除异常"+exception.getMessage());
            return false;
        }
    }
}
